package com.hnevc.xiewenguang;

public class Example02 {
    public static void main(String[] args) {
        int result = 0;
        try{
         result = divide(4,-2);


        }catch (DivieByMinusException e){
            System.out.println(e.getCause());

        }
        System.out.println(result);


    }


    public  static  int divide(int x, int y)throws  DivieByMinusException{
        int result = 0;
        if (y>0) {


            result = x / y;
        }else {
            throw  new DivieByMinusException("除数是负数");

        }
            return result;

    }
}


